package com.itheima.day04.objects;

import java.util.StringJoiner;

public class Stringjoiner {
    public static void main(String[] args) {
        int [] a = {1,2,3,4,5};
        getdata(a);
    }
    public static void getdata(int[] a){
        StringJoiner sj = new StringJoiner(",","[","]");
        for (int i = 0; i < a.length; i++) {
            if(a.length!=0){
                sj.add(String.valueOf(a[i]));
            }else{
                System.out.println("当前无数组");
            }

        }
        System.out.println(sj.toString());
    }
}
